package com.hydra.auth.service;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hydra.auth.entity.IdGenerator;
import com.hydra.auth.mapper.IdGeneratorMapper;
import org.springframework.stereotype.Service;

@Service
public class IdGeneratorService extends ServiceImpl<IdGeneratorMapper, IdGenerator> {

	public IdGenerator findByName(String name){
		return this.baseMapper.selectOne(Wrappers.<IdGenerator>lambdaQuery()
				.eq(IdGenerator::getName, name)
				.last("limit 1"));
	}

}
